﻿@model PagedList.IPagedList<CultuRAM.Models.EventPropertyValue>

@if (Model != null && Model.Count != 0){
 
    <table id="tableProp" class="table table-hover table-striped table-bordered" style="width:100%;">
        <tr>
            <th style="width: 30%;">
                @Html.DisplayNameFor( model => model.FirstOrDefault().EventProperty.Name)    
            </th>
            <th style="width: 70%;">
                @Html.DisplayNameFor( model => model.FirstOrDefault().Value )
            </th>
        </tr>          
          @foreach (var item in Model)
          {
              <tr id="@item.PropertyValueId">
                  <td style="font-weight: bold;">
                      @Html.DisplayFor(modelItem => item.EventProperty.Name)
                  </td>
                  <td>
                      @Html.DisplayFor(modelItem => item.Value)
                  </td>
              </tr>
          }
    </table>

    <div class="row-fluid pagination-botton"> 
        <div class="span6">
           
            @Html.Raw(@Ajax.ActionLink("replacetxt", "CreatePv", "EventPropertyValues", new { page = Model.PageNumber, idEvent = Model.FirstOrDefault().Event.EventId },new AjaxOptions
		                        {
			                         UpdateTargetId="tabEventPropRight", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET", 
                                     OnComplete = "PropBgColorAdd()"
		                        }, new { @class = "btn btn-success btn-xs", id="btnAddProp" })
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-plus icon-white\"></i> Adicionar"))
           
             @Html.Raw(@Ajax.ActionLink("replacetxt", "EditPv", "EventPropertyValues", new { page = Model.PageNumber, idEvent = Model.FirstOrDefault().Event.EventId },new AjaxOptions
		                        {
			                         UpdateTargetId="tabEventPropRight", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET",
                                     OnComplete = "PropBgColorEdit()" 
		                        }, new { @class = "btn btn-warning btn-xs", id="btnEditProp" })
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-pencil icon-white\"></i> Editar"))
            
            @Html.Raw(@Ajax.ActionLink("replacetxt", "EditPv", "EventPropertyValues", new { page = Model.PageNumber }, new AjaxOptions
		                        {
			                         UpdateTargetId = "tabEventPropRight",
                                     InsertionMode = InsertionMode.Replace,
                                     HttpMethod = "GET",
                                     OnComplete = "PropBgColorDel()"
		                        }, new { @class = "btn btn-danger btn-xs", id="btnDelProp" })
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-remove icon-white\"></i> Eliminar"))
        </div> 
    
        <div class="span6">
            <div class="pagination" style="margin: 0; margin-left: 40px;">
                <ul>
                    @if (Model.HasPreviousPage)
                    {
                        <li>
                            @Ajax.ActionLink("«", "IndexPv", "EventPropertyValues", new { page = 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventPropLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li> 
                        <li>
                            @Ajax.ActionLink("<", "IndexPv", "EventPropertyValues", new { page = Model.PageNumber - 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventPropLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li class="">
                            <a href="#" data-original-title="" title="" class="">
                                Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                            </a>
                        </li>  
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="">«</a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class=""><</a></li> 
                        <li class="">
                            <a href="#" data-original-title="" title="" class="disabled">
                                Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                            </a>
                        </li> 
                    }
                    <li>
                    @if (Model.HasNextPage)
                    {
                        <li>
                            @Ajax.ActionLink(">", "IndexPv", "EventPropertyValues", new { page = Model.PageNumber + 1, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventPropLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li>
                            @Ajax.ActionLink("»", "IndexPv", "EventPropertyValues", new { page = Model.PageCount, idEvent = Model.FirstOrDefault().Event.EventId},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="tabEventPropLeft", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">></a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">»</a></li>
                    }
                </ul>
            </div>
        </div>

    </div>
    }
    else{
    
    <div id="msgInf_" class="alert alert-warning" style="margin-top: 10px;">Este evento não tem Propriedades definidas!</div><br/>
        <p>
             @Html.Raw(@Ajax.ActionLink("replacetxt", "CreatePv", "EventPropertyValues", new { idEvent = ViewBag.idEv },new AjaxOptions
		                        {
			                         UpdateTargetId="tabEventPropRight", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET", 
                                     OnComplete = "PropBgColorAdd()"
		                        }, new { @class = "btn btn-success btn-xs", id="btnAddProp" })
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-plus icon-white\"></i> Adicionar"))
        </p>
}


@Scripts.Render("~/bundles/culturam")